package org.example.yidaiyilu.entity;

import java.util.ArrayList;
import java.util.List;

public class ZiTiao {

    private String zimu = null;

    private String tongxingxuhao = null;

    private String pinyin = null;

    private String bihua = null;

    private String bushou = null;

    private String jiegou = null;

    private String zhuyi = null;

    private String lingjian = null;

    public void setLingjian(String lingjian) {
        this.lingjian = lingjian;
    }

    public void setZhuyi(String zhuyi) {
        this.zhuyi = zhuyi;
    }



    private List<YiXiang> yixiangList =new ArrayList<YiXiang>();


    public void setZimu(String zimu) {
        this.zimu = zimu;
    }

    public void setTongxingxuhao(String tongxingxuhao) {
        this.tongxingxuhao = tongxingxuhao;
    }

    public void setPinyin(String pinyin) {
        this.pinyin = pinyin;
    }

    public void setBihua(String bihua) {
        this.bihua = bihua;
    }

    public void setBushou(String bushou) {
        this.bushou = bushou;
    }

    public void setJiegou(String jiegou) {
        this.jiegou = jiegou;
    }


    public List getYixiangList() {
        return this.yixiangList;

    }

    public String toString(){
        StringBuilder sb = new StringBuilder();
        sb.append("<词条>");
        if(zimu != null && !"".equals(zimu)){
            sb.append("<字目>").append(zimu.trim()).append("</字目>");
        }
        if(tongxingxuhao != null && !"".equals(tongxingxuhao)){
            sb.append("<同形序号>").append(tongxingxuhao.trim()).append("</同形序号>");
        }
        if(pinyin != null && !"".equals(pinyin)){
            sb.append("<拼音>").append(pinyin.replace("ɡ","g").replace("ɑ","a").trim()).append("</拼音>");
        }
        if(bihua != null && !"".equals(bihua)){
            sb.append("<笔画>").append(bihua.trim()).append("</笔画>");
        }
        if(bushou != null && !"".equals(bushou)){
            sb.append("<部首>").append(bushou.trim()).append("</部首>");
        }
        if(jiegou != null && !"".equals(jiegou)){
            sb.append("<结构>").append(jiegou.trim()).append("</结构>");
        }

        for(int i=0; i<yixiangList.size(); i++){
            sb.append(yixiangList.get(i).toString());
        }
        if(zhuyi != null && !"".equals(zhuyi)){
            sb.append("<注意>").append(zhuyi).append("</注意>");
        }
        if(lingjian != null && !"".equals(lingjian)){
            sb.append("<另见>").append(lingjian).append("</另见>");
        }
        sb.append("</词条>");
        return sb.toString();
    }
}
